package com.dynamictpm.notify;

import java.io.Serializable;
import java.util.concurrent.atomic.AtomicLong;

/**
 * 描述：：
 * <p>
 * ------------------------------------
 *
 * @program: dynamic-tpm
 * @ClassName Event
 * @author: it-yml
 * @create: 2023-07-05 16:10
 * @Version 1.0
 * --------------------------------------
 **/
public abstract class Event implements Serializable {
    private static final AtomicLong SEQUENCE = new AtomicLong(0);

    private final long sequence = SEQUENCE.getAndIncrement();

    /**
     * Event sequence number, which can be used to handle the sequence of events.
     *
     * @return sequence num, It's best to make sure it's monotone.
     */
    public long sequence() {
        return sequence;
    }
}
